import React from 'react'
import {useSelector,useDispatch} from 'react-redux'
import {incrementSync} from '../store/modules/counter'
export default function Counter() {
   
    const num=useSelector(state=>{
        return state.counter.num
    })
    const dispatch=useDispatch()
  return (
    <div>
        <h2>{num}</h2>
        <button onClick={()=>{
            dispatch(incrementSync(3))
        }}>+</button>
    </div>
  )
}
